﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Main.Master" AutoEventWireup="true" CodeBehind="TableManagement.aspx.cs" Inherits="RestaurantManagerWebApp.Pages.TableManagement.MainTableManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style37 {
            width: 869px;
        }
        .auto-style38 {
            width: 170px;
        }
        .auto-style39 {
            width: 150px;
        }
        .auto-style40 {
            width: 154px;
        }
        .auto-style41 {
            width: 161px;
        }
        .auto-style43 {
            height: 23px;
            width: 242px;
        }
        .auto-style44 {
            width: 242px;
        }
        .auto-style46 {
            width: 210px;
        }
        .auto-style47 {
            width: 357px;
        }
        .auto-style49 {
            width: 451px;
        }
        .auto-style50 {
            width: 220px;
        }
        .auto-style51 {
            width: 231px;
        }
        .auto-style53 {
            width: 13px;
        }
        .auto-style54 {
            width: 447px;
        }
        .auto-style55 {
            width: 440px;
        }
        .auto-style56 {
            width: 430px;
        }
        .auto-style57 {
            width: 237px;
        }
        .auto-style58 {
            width: 253px;
        }
        .auto-style59 {
            width: 152px;
        }
        .auto-style60 {
            width: 148px;
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="auto-style37">
        <tr>
            <td class="auto-style57">
            <asp:Label ID="Label6" runat="server" Text="Table Management Menu"></asp:Label>
            </td>
            <td class="auto-style49">
                &nbsp;</td>
            <td class="auto-style58">&nbsp;</td>
            <td class="auto-style47">&nbsp;</td>
        </tr>
        <tr>
            <td class="auto-style57">
            <asp:Button ID="buttonManageTables" runat="server" OnClick="buttonManageTables_Click" Text="Manage Tables" />
            </td>
            <td class="auto-style49">
            <asp:Button ID="buttonAllocateTables" runat="server" OnClick="buttonAllocateTables_Click" Text="Allocate Tables" style="margin-left: 0px" />
            </td>
            <td class="auto-style58">
                &nbsp;</td>
            <td class="auto-style47">
            <asp:Button ID="buttonReturn" runat="server" OnClick="buttonReturn_Click" Text="Return to Main Table Management" Width="207px" />
            </td>
        </tr>
    </table>
    <table class="auto-style37">
        <tr>
            <td class="auto-style59">&nbsp;</td>
            <td class="auto-style60">&nbsp;</td>
            <td>&nbsp;</td>
            <td class="auto-style53">&nbsp;</td>
        </tr>
        <tr>
            <td class="auto-style59">
                <asp:Button ID="btnLayout" runat="server" OnClick="btnLayout_Click" Text="Table Layout" />
            </td>
            <td class="auto-style60">
                <asp:Button ID="btnAddTables" runat="server" OnClick="btnAddTables_Click" Text="Add Tables" />
            </td>
            <td>
                <asp:Button ID="btnEditTables" runat="server" OnClick="btnEditTables_Click" Text="Edit/Delete Tables" />
            </td>
            <td class="auto-style53">
                &nbsp;</td>
        </tr>
    </table>
    <a name="focusLabel">
        <asp:Label ID="labelStatus" runat="server" Text="Label" Visible="False" style="font-size: medium"></asp:Label>
    </a>
<br />
    <asp:MultiView ID="mvManageTables" runat="server">
        <asp:View ID="viewManage" runat="server">
            <table class="auto-style37">
                <tr>
                    <td class="auto-style55"></td>
                    <td class="auto-style56"></td>
                </tr>
                <tr>
                    <td class="auto-style54">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="#999999" DataKeyNames="table_no" DataSourceID="SqlDataSource1" Height="162px" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" ShowFooter="True" style="margin-right: 4px; font-size: medium;" Width="824px">
                            <Columns>
                                <asp:TemplateField HeaderText="Table No" SortExpression="table_no">
                                    <EditItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("table_no") %>'></asp:Label>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("table_no") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="18px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Availability" SortExpression="status">
                                    <EditItemTemplate>
                                        <asp:Label ID="lblAvailability" runat="server" Text='<%# Bind("status") %>' Visible="false"></asp:Label>
                                        <asp:DropDownList ID="ddlEditStatus" runat="server" Text='<%# Bind("status") %>'>
                                            <asp:ListItem Value="Available">Available</asp:ListItem>
                                            <asp:ListItem Value="Occupied">Occupied</asp:ListItem>
                                            <asp:ListItem Value="Reserved">Reserved</asp:ListItem>
                                        </asp:DropDownList>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("status") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Capacity" SortExpression="capacity">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("capacity") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("capacity") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="30px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Category" SortExpression="table_desc">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("t_category") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("t_category") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="45px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Deletion" ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Eval("table_no") %>' CommandName="Delete">
                    Delete</asp:LinkButton>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="30px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Update" ShowHeader="False">
                                    <EditItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="True" CommandArgument='<%# Eval("table_no") %>' CommandName="Update" Text="Update"></asp:LinkButton>
                                        &nbsp;<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                                    </EditItemTemplate>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit"></asp:LinkButton>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Center" Width="30px" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [Tables] WHERE [table_no] = @table_no" InsertCommand="INSERT INTO [Tables] ([table_no], [status], [capacity]) VALUES (@table_no, @status, @capacity)" SelectCommand="SELECT table_no, status, capacity, t_category FROM Tables WHERE (status &lt;&gt; 'NIL') ORDER BY CAST(table_no AS decimal)" UpdateCommand="UPDATE [Tables] SET [status] = @status, [capacity] = @capacity, [t_category] = @t_category WHERE [table_no] = @table_no">
                            <DeleteParameters>
                                <asp:Parameter Name="table_no" Type="String" />
                            </DeleteParameters>
                            <InsertParameters>
                                <asp:Parameter Name="table_no" Type="String" />
                                <asp:Parameter Name="status" Type="String" />
                                <asp:Parameter Name="capacity" Type="Decimal" />
                            </InsertParameters>
                            <UpdateParameters>
                                <asp:Parameter Name="status" Type="String" />
                                <asp:Parameter Name="capacity" Type="Decimal" />
                                <asp:Parameter Name="t_category" />
                                <asp:Parameter Name="table_no" Type="String" />
                            </UpdateParameters>
                        </asp:SqlDataSource>
                    </td>
                    <td>&nbsp;</td>
                </tr>
            </table>
            <br />
        </asp:View>
        <asp:View ID="viewAdd" runat="server">
            <table class="auto-style3">
                <tr>
                    <td class="auto-style46" colspan="2">
                        <asp:Label ID="Label8" runat="server" Text="Select the number of tables to be added."></asp:Label>
                        <br />
                        &nbsp;<asp:DropDownList ID="ddlNewTables" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlNewTables_SelectedIndexChanged">
                            <asp:ListItem Value="0">0</asp:ListItem>
                            <asp:ListItem Value="1">1</asp:ListItem>
                            <asp:ListItem Value="2">2</asp:ListItem>
                            <asp:ListItem Value="3">3</asp:ListItem>
                            <asp:ListItem Value="4">4</asp:ListItem>
                            <asp:ListItem Value="5">5</asp:ListItem>
                            <asp:ListItem Value="6">6</asp:ListItem>
                            <asp:ListItem Value="7">7</asp:ListItem>
                            <asp:ListItem Value="8">8</asp:ListItem>
                            <asp:ListItem Value="9">9</asp:ListItem>
                            <asp:ListItem Value="10">10</asp:ListItem>
                            <asp:ListItem Value="11">11</asp:ListItem>
                            <asp:ListItem Value="12">12</asp:ListItem>
                            <asp:ListItem Value="13">13</asp:ListItem>
                            <asp:ListItem Value="14">14</asp:ListItem>
                            <asp:ListItem Value="15">15</asp:ListItem>
                            <asp:ListItem Value="16">16</asp:ListItem>
                            <asp:ListItem Value="17">17</asp:ListItem>
                            <asp:ListItem Value="18">18</asp:ListItem>
                            <asp:ListItem Value="19">19</asp:ListItem>
                            <asp:ListItem Value="20">20</asp:ListItem>
                            <asp:ListItem Value="21">21</asp:ListItem>
                            <asp:ListItem Value="22">22</asp:ListItem>
                            <asp:ListItem Value="23">23</asp:ListItem>
                            <asp:ListItem Value="24">24</asp:ListItem>
                            <asp:ListItem Value="25">25</asp:ListItem>
                            <asp:ListItem Value="26">26</asp:ListItem>
                            <asp:ListItem Value="27">27</asp:ListItem>
                            <asp:ListItem Value="28">28</asp:ListItem>
                            <asp:ListItem Value="29">29</asp:ListItem>
                            <asp:ListItem Value="30">30</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td class="auto-style40">&nbsp;</td>
                    <td class="auto-style41">&nbsp;</td>
                    <td class="auto-style44">&nbsp;</td>
                </tr>
                <tr>
                    <td class="auto-style38">
                        <asp:Label ID="Label3" runat="server" CssClass="auto-style32" Text="Table No" Visible="False"></asp:Label>
                    </td>
                    <td class="auto-style39">
                        <asp:Label ID="Label4" runat="server" CssClass="auto-style32" Text="Availability" Visible="False"></asp:Label>
                    </td>
                    <td class="auto-style40">
                        <asp:Label ID="Label5" runat="server" CssClass="auto-style32" Text="Capacity" Visible="False"></asp:Label>
                    </td>
                    <td class="auto-style41">
                        <asp:Label ID="Label7" runat="server" Text="Category" Visible="False"></asp:Label>
                    </td>
                    <td class="auto-style43">&nbsp;</td>
                </tr>
                <tr>
                    <td class="auto-style38">
                        <asp:PlaceHolder ID="autoGenTextbox" runat="server"></asp:PlaceHolder>
                    </td>
                    <td class="auto-style39">
                        <asp:PlaceHolder ID="autoGenTextbox0" runat="server"></asp:PlaceHolder>
                    </td>
                    <td class="auto-style40">
                        <asp:PlaceHolder ID="autoGenTextbox1" runat="server"></asp:PlaceHolder>
                    </td>
                    <td class="auto-style41">
                        <asp:PlaceHolder ID="autoGenTextbox2" runat="server"></asp:PlaceHolder>
                    </td>
                    <td class="auto-style44">&nbsp;</td>
                </tr>
                <tr>
                    <td class="auto-style38">
                        <asp:Button ID="buttonNewTable" runat="server" CommandName="buttonNewTable" OnClick="Button1_Click" Text="Add New Tables" />
                    </td>
                    <td class="auto-style39">&nbsp;</td>
                    <td class="auto-style40">&nbsp;</td>
                    <td class="auto-style41">&nbsp;</td>
                    <td class="auto-style44">&nbsp;</td>
                </tr>
            </table>
            <br />
        </asp:View>
        <asp:View ID="viewLayout" runat="server">
            <table class="auto-style3">
                <tr>
                    <td class="auto-style50">
                        <asp:Image ID="Image1" runat="server" Height="480px" ImageUrl="~/Images/restaurantTableLayout.JPG" Width="691px" />
                    </td>
                    <td class="auto-style51">&nbsp;</td>
                </tr>
                <tr>
                    <td class="auto-style50">
                        <asp:FileUpload ID="FileUploadLayout" runat="server" />
                    </td>
                    <td class="auto-style51">&nbsp;</td>
                </tr>
                <tr>
                    <td class="auto-style50">
                        <asp:Button ID="uploadLayout" runat="server" OnClick="uploadLayout_Click" Text="Upload" />
                        &nbsp;&nbsp;&nbsp;
                        <asp:Label ID="lblUploadStatus" runat="server" style="font-size: medium" Text="Label" Visible="False"></asp:Label>
                    </td>
                    <td class="auto-style51">&nbsp;</td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
<br />
</asp:Content>
